package com.corpgovernment.organization.enumm;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 同步用户信息操作类型
 * @author xiaowuwang
 */
@Getter
public enum SynEmployeeActionTypeEnum {
    ADD("add", "45"),
    UPDATE("update", "46"),
    DELETE("delete", "47"),
    TRANSFER("transfer", "46"),
    ;
    private String code;
    private String bizType;
    SynEmployeeActionTypeEnum(String code, String bizType){
        this.code = code;
        this.bizType = bizType;
    }

    private static Map<String, SynEmployeeActionTypeEnum> bizTypeMap = new HashMap<>();
    static {
        for(SynEmployeeActionTypeEnum actionTypeEnum:SynEmployeeActionTypeEnum.values()){
            bizTypeMap.put(actionTypeEnum.getBizType(), actionTypeEnum);
        }
    }
    public static String getActionTypeByBizType(String bizType){
        if(bizType==null || "".equals(bizType.trim())){
            return null;
        }
        SynEmployeeActionTypeEnum actionTypeEnum = bizTypeMap.get(bizType);
        if(actionTypeEnum!=null){
            return actionTypeEnum.getCode();
        }
        return null;
    }
}
